/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vista;

import clases.Venta;
import com.alee.extended.date.WebDateField;
import com.alee.extended.panel.GroupPanel;
import com.alee.laf.button.WebButton;
import com.alee.laf.checkbox.WebCheckBox;
import com.alee.laf.label.WebLabel;
import com.alee.laf.panel.WebPanel;
import com.alee.laf.rootpane.WebDialog;
import com.alee.laf.table.WebTable;
import com.alee.laf.text.WebTextField;
import controlador.CtrlArticulo;
import controlador.CtrlCategoria;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import javax.swing.ImageIcon;

/**
 *
 * @author togapaulo
 */
public class FrmVenta extends WebDialog implements ActionListener{

    private Venta venta;
    private CtrlCategoria ctrlCategoria;
    private CtrlArticulo ctrlArticulo;
    
    private WebPanel contenedor;
    
    private WebTable tblDetalleVenta;
    private WebDateField txtFecha;
    private WebTextField txtCliente;
    private WebButton btnBuscar;
    private WebTextField txtCodigoBarras;
    private WebLabel lblTotal;
    private WebButton btnEliminar;
    private WebButton btnGuardar;
    private WebButton btnLimpiar;
    
    private WebLabel iconBodega;
    private WebTextField txtBusqueda;
    private WebCheckBox chbSinStock;
    private WebLabel lblUsuario;
    
    public FrmVenta(){
        setTitle("Venta");
        setDefaultCloseOperation(WebDialog.DISPOSE_ON_CLOSE);
        setSize(800,800);
        setLocationRelativeTo(null);
        setShowResizeCorner(false);
        setShowMaximizeButton(false);
        initComponents();
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    private void initComponents() {
        contenedor = new WebPanel();
        tblDetalleVenta = new WebTable();
        txtFecha = new WebDateField(new Date());
        txtCliente = new WebTextField();
        txtCliente.setInputPrompt("Buscar Cliente");
        btnBuscar = new WebButton(new ImageIcon(getClass().getResource("/resources/img/zoom.png")));
        txtCodigoBarras = new WebTextField();
        txtCodigoBarras.setInputPrompt("Código de Barras");
        lblTotal = new WebLabel("Total : S/.");
        btnEliminar = new WebButton(new ImageIcon(getClass().getResource("/resources/img/delete.png")));
        btnGuardar = new WebButton(new ImageIcon(getClass().getResource("/resources/img/disk.png")));
        btnLimpiar = new WebButton(new ImageIcon(getClass().getResource("/resources/img/cancel.png")));

        iconBodega = new WebLabel();
        txtBusqueda = new WebTextField("Búsqueda");
        chbSinStock = new WebCheckBox();
        lblUsuario = new WebLabel();
        
        this.add(contenedor);
        this.contenedor.setLayout(new BorderLayout());
        
        this.contenedor.add(new GroupPanel(){
            {
                this.setLayout(new BorderLayout());
                this.add(new GroupPanel(){
                    {
                        this.setLayout(new BorderLayout());
                        this.add(new GroupPanel(){
                            {
                                this.setLayout(new GridLayout(2,1));
                                this.add(iconBodega);
                                this.add(new GroupPanel(){
                                    {
                                        this.setLayout(new BorderLayout());
                                        this.add(txtBusqueda, BorderLayout.CENTER);
                                        this.add(chbSinStock, BorderLayout.WEST);
                                    }
                                });
                            }                            
                        },BorderLayout.NORTH);//Seccion norte de la parte de articulos
                        this.add(new GroupPanel(){
                            {
                                this.setLayout(new BorderLayout());
                                this.add(new GroupPanel(){}, BorderLayout.EAST);
                                this.add(new GroupPanel(){}, BorderLayout.CENTER);
                            }
                        }, BorderLayout.CENTER);
                        this.add(lblUsuario,BorderLayout.SOUTH);//Seccion sur de la parte de articulos
                    }
                }, BorderLayout.CENTER);
                this.add(new GroupPanel(){
                    {
                        this.setLayout(new BorderLayout());
                        this.add(new GroupPanel(){
                            {
                                this.setLayout(new GridLayout(3,1));
                                this.add(txtFecha);
                                this.add(new GroupPanel(){
                                    {
                                        this.setLayout(new BorderLayout());
                                        this.add(txtCliente, BorderLayout.CENTER);
                                        this.add(txtCodigoBarras);
                                        this.add(new GroupPanel(){
                                            {
                                                this.setLayout(new BorderLayout());
                                                
                                            }
                                        });
                                    }
                                });
                            }
                        }, BorderLayout.NORTH);
                        this.add(this, BorderLayout.CENTER);
                        this.add(this, BorderLayout.SOUTH);
                    }
                }, BorderLayout.WEST);
            }
        });
    }
    
}